﻿@baby_hair_age = 5
@african_clothing_no_hair_chance = 6.5

# Make sure the weights here match up best as possible with the custom_hair set
hairstyles = {

	usage = game
	selection_behavior = weighted_random

	western_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = western_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_western_clothing_trigger = yes
			}
		}
	}

	western_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = western_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_western_clothing_trigger = yes
			}
		}
	}

	western_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = western_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_western_clothing_trigger = yes
			}
		}
	}

	western_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = western_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_western_clothing_trigger = yes
			}
		}
	}

	mena_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = mena_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_mena_clothing_trigger = yes
			}
		}
	}

	mena_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = mena_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_mena_clothing_trigger = yes
			}
		}
	}

	mena_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = mena_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_mena_clothing_trigger = yes
			}
		}
	}

	mena_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = mena_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_mena_clothing_trigger = yes
			}
		}
	}

	byzantine_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = byzantine_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_byzantine_clothing_trigger = yes
			}
		}
	}

	byzantine_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = byzantine_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_byzantine_clothing_trigger = yes
			}
		}
	}

	byzantine_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = byzantine_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_byzantine_clothing_trigger = yes
			}
		}
	}

	byzantine_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = byzantine_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_byzantine_clothing_trigger = yes
			}
		}
	}



	indian_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = indian_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_indian_clothing_trigger = yes
			}
		}
	}

	indian_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = indian_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_indian_clothing_trigger = yes
			}
		}
	}

	indian_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = indian_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_indian_clothing_trigger = yes
			}
		}
	}

	indian_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = indian_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_indian_clothing_trigger = yes
			}
		}
	}

	steppe_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = steppe_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_steppe_clothing_trigger = yes
			}
			modifier = {
				factor = 0
				portrait_fp3_turkic_clothing_trigger = yes
				has_fp3_dlc_trigger = yes 
			}
		}
	}

	steppe_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = steppe_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_steppe_clothing_trigger = yes
			}
			modifier = {
				factor = 0
				portrait_fp3_turkic_clothing_trigger = yes
				has_fp3_dlc_trigger = yes 
			}
		}
	}

	steppe_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = steppe_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_steppe_clothing_trigger = yes
			}
			modifier = {
				factor = 0
				portrait_fp3_turkic_clothing_trigger = yes
				has_fp3_dlc_trigger = yes 
			}
		}
	}

	steppe_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = steppe_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_steppe_clothing_trigger = yes
			}
		}
	}

	mpo_mongol = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = mpo_mongol_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_steppe_clothing_trigger = yes
				has_mpo_dlc_trigger = yes 
			}
			modifier = {
				factor = 0
				portrait_fp3_turkic_clothing_trigger = yes
				has_fp3_dlc_trigger = yes 
			}
		}
	}

	northern_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = northern_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
					portrait_ugro_permian_clothing_trigger = yes
				}
			}
		}
	}

	northern_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = northern_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
					portrait_ugro_permian_clothing_trigger = yes
				}
			}
		}
	}

	northern_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = northern_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
					portrait_ugro_permian_clothing_trigger = yes
				}
			}
		}
	}

	northern_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = northern_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				OR = {
					portrait_northern_clothing_trigger = yes
					portrait_sami_clothing_trigger = yes
				}
			}
		}
	}

	african_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sub_saharan_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_african_clothing_trigger = yes
			}
		}
	}

	african_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sub_saharan_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_african_clothing_trigger = yes
			}
		}
	}

	african_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sub_saharan_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_african_clothing_trigger = yes
			}
		}
	}

	african_afro = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sub_saharan_hairstyles_afro
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_afro
				}
				portrait_african_clothing_trigger = yes
			}
		}
	}

	baby_hair = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = western_baby_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 100
				scope:age < @baby_hair_age
				NOT = { portrait_african_clothing_trigger = yes } # Should be replaced with a has_gene trigger when we get that
			}
		}
	}

	baby_hair_sub_saharan = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sub_saharan_baby_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		# outfit_tags = { no_clothes }
		weight = {
			base = 0
			modifier = {
				add = 100
				scope:age < @baby_hair_age
				portrait_african_clothing_trigger = yes # Should be replaced with a has_gene trigger when we get that
			}
		}
	}

	no_hair = { # This is to give a random chance of a clean shaven look
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = no_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = -100
				scope:age < @baby_hair_age
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
			# Different likelyhood of a clean shaven look in different cultures
			modifier = {
				add = @african_clothing_no_hair_chance
				portrait_african_clothing_trigger = yes
			}
			modifier = {
				add = 2000
				exists = this
				has_nickname = nick_the_actually_bald
			}
			modifier = {
				add = 2000
				exists = this
				has_character_modifier = hajj_halq_modifier
			}
			modifier = {
				add = 2000
				exists = this
				has_character_modifier = shaven_bald_modifier
			}
			modifier = {
				add = 2000
				exists = this
				has_character_flag = bald_head
			}
		}
	}

	# default_hair = {
	#     weight = {
	#         base = 0
	#         modifier = {
	#             add = 100
	#             scope:age >= @baby_hair_age
	#         }
	#         # This can't be always 100 otherwise it will get insta picked, so we subtract the no hair chance off to weight it properly
	#         modifier = {
	#             add = {
	#                 subtract = @african_clothing_no_hair_chance
	#             }
	#             portrait_african_clothing_trigger = yes
	#         }
	#     }
	# }

	### FP3 Hair ###
	#iranian
	fp3_hairstyles_iranian_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_iranian_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp3_iranian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = no
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp3_hairstyles_iranian_straight_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_iranian_straight_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp3_iranian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = yes
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}


	fp3_hairstyles_iranian_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_iranian_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_fp3_iranian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = no
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp3_hairstyles_iranian_wavy_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_iranian_wavy_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = yes
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp3_iranian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	#turkic
	fp3_hairstyles_turkic_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_turkic_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp3_turkic_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = no
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp3_hairstyles_turkic_straight_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_turkic_straight_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp3_turkic_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = yes
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp3_hairstyles_turkic_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_turkic_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_fp3_turkic_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = no
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp3_hairstyles_turkic_wavy_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp3_hairstyles_turkic_wavy_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = yes
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp3_turkic_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	### FP2 Hair ###

	fp2_hairstyles_iberian_muslim_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = no
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_muslim_straight_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_straight_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				is_lowborn = yes
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_muslim_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = no
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_muslim_wavy_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_wavy_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = yes
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_muslim_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = no
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_muslim_curly_commoners = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_muslim_curly_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				is_lowborn = yes
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_fp2_iberian_muslim_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_christian_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_christian_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp2_iberian_christian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_christian_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_christian_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp2_iberian_christian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp2_hairstyles_iberian_christian_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp2_hairstyles_iberian_christian_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				portrait_fp2_iberian_christian_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	### FP1 Hair ###

	fp1_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp1_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_fp1_norse_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	fp1_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = fp1_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				portrait_fp1_norse_clothing_trigger = yes
			}
			modifier = {
				add = -100
				exists = this
				OR = {
					is_from_ruler_designer = yes
					has_character_flag = has_scripted_appearance
				}
			}
		}
	}

	male_hair_rtt_01 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = rtt_hairstyles
				value = 0
			}
		}

		is_valid_custom = {
			#monarchs_journey_unlock = 6
			trigger_if = {
				limit = { exists = root }
				is_female = no
			}
			trigger_else = {
				scope:female = no
			}
		}

		weight = {
			base = 0
			modifier = {
				add = 55
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_wavy
				}
				culture = culture:scottish
			}
		}
	}

	male_hair_rtt_02 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = rtt_hairstyles
				value = 1
			}
		}

		is_valid_custom = {
			#monarchs_journey_unlock = 2
			trigger_if = {
				limit = { exists = root }
				is_female = no
			}
			trigger_else = {
				scope:female = no
			}
		}

		weight = {
			base = 0
		}
	}

	female_hair_rtt_02 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = rtt_hairstyles
				value = 0.5
			}
		}

		is_valid_custom = {
			#monarchs_journey_unlock = 8
			trigger_if = {
				limit = { exists = root }
				is_female = yes
			}
			trigger_else = {
				scope:female = yes
			}
		}

		weight = {
			base = 0
			modifier = {
				add = 25
				exists = this
				has_gene = {
					category = gene_hair_type
					template = hair_curly
				}
				culture = { has_cultural_pillar = heritage_frankish }
			}
		}
	}

	female_hair_rtt_01 = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = rtt_hairstyles
				value = 0
			}
		}

		is_valid_custom = {
			#monarchs_journey_unlock = 7
			trigger_if = {
				limit = { exists = root }
				is_female = yes
			}
			trigger_else = {
				scope:female = yes
			}
		}

		weight = {
			base = 0
		}
	}

	female_hair_rtt_02_milla = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = rtt_hairstyles
				value = 1
			}
		}

		is_valid_custom = {
			#monarchs_journey_unlock = 7
			trigger_if = {
				limit = { exists = root }
				is_female = yes
			}
			trigger_else = {
				scope:female = yes
			}
		}

		weight = {
			base = 0
		}
	}

	### EP2 Hair ###

	ep2_hairstyles_western_nobility = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep2_hairstyles_western
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = { # Men
				add = 55
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_western_clothing_trigger = yes
				portrait_era1_trigger = yes
				NOT = {
					portrait_commoner_trigger = {
						CULTURE_INPUT = western
					}
				}
			}
			modifier = { # Women
				add = 105
				is_female = yes
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_western_clothing_trigger = yes
				portrait_era1_trigger = yes
				OR = {
					portrait_high_nobles_trigger = {
						CULTURE_INPUT = western
					}
					portrait_royalty_trigger = {
						CULTURE_INPUT = western
					}
					portrait_imperial_trigger = {
						CULTURE_INPUT = western
					}
				}
			}
		}
	}

	ep2_hairstyles_western_common = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep2_hairstyles_western_common
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 10
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_western_clothing_trigger = yes
				has_ep2_dlc_trigger = yes
			}
		}
	}

	sp3_hairstyles_western = { # Louis IX hairstyle
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sp3_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 10
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_western_clothing_trigger = yes
				has_dlc_feature = couture_of_the_capets
			}
			modifier = {
				factor = 0
				has_ep2_dlc_trigger = yes
				NOR = {
					portrait_era3_trigger = yes
					portrait_era4_trigger = yes
				}
			}
		}
	}

	### EP3 Hair ###
	ep3_byzantine = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep3_byzantine_hairstyle
				range = { 0 1 }
			}
		}
		weight = {
			base = 0
		}
	}

	ep3_byzantine_wavy = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep3_byzantine_hairstyles_wavy
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = { # Men
				add = 55
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
			modifier = { # Women
				add = 105
				is_female = yes
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
		}
	}

	ep3_byzantine_curly = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep3_byzantine_hairstyles_curly
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = { # Men
				add = 55
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
			modifier = { # Women
				add = 105
				is_female = yes
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
		}
	}

	ep3_byzantine_straight = {
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = ep3_byzantine_hairstyles_straight
				range = { 0 1 } # For the randomness to work correctly
			}
		}
		weight = {
			base = 0
			modifier = { # Men
				add = 55
				is_female = no
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
			modifier = { # Women
				add = 105
				is_female = yes
				OR = {
					NOT = { exists = this }
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
				}
				portrait_byzantine_clothing_trigger = yes
				has_ep3_dlc_trigger = yes
			}
		}
	}

	### SP4 - Crowns of the World ###

	sp4_hairstyles_mena = { 
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sp4_mena_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 30
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_straight
					}
					has_gene = {
						category = gene_hair_type
						template = hair_straight_thin_beard
					}
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
				}
				portrait_mena_clothing_trigger = yes
				has_sp4_dlc_trigger = yes
			}
		}
	}

	sp4_hairstyles_western_male = { # High/Late Medieval Style for men
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sp4_western_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 20
				is_male = yes 
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
				}
				portrait_western_clothing_trigger = yes
				has_sp4_dlc_trigger = yes
			}
			modifier = {
				factor = 0
				NOR = {
					portrait_era3_trigger = yes   
					portrait_era4_trigger = yes 
				}             
			}
		}
	}

	sp4_hairstyles_western_female = { 
		dna_modifiers = {
			accessory = {
				mode = add
				gene = hairstyles
				template = sp4_western_hairstyles
				range = { 0 1 } # For the randomness to work correctly
			}
		}   
		weight = {
			base = 0
			modifier = {
				add = 20
				is_female = yes 
				OR = {
					has_gene = {
						category = gene_hair_type
						template = hair_wavy
					}
					has_gene = {
						category = gene_hair_type
						template = hair_curly
					}
				}
				portrait_western_clothing_trigger = yes
				has_sp4_dlc_trigger = yes
			}
		}
	}


    # Shogunate

    japanese_generic = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = hairstyles
                template = japanese_hairstyles
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_afro
                    }
                }
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                shogunate_should_be_no_hair_trigger = no
                has_fp2_dlc_trigger = no
                exists = dynasty
            }
        }
    }

    japanese_fp2_generic = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = hairstyles
                template = japanese_hairstyles_fp2
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_afro
                    }
                }
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                shogunate_should_be_no_hair_trigger = no
                has_fp2_dlc_trigger = yes
                exists = dynasty
            }
        }
    }

    japanese_common = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = hairstyles
                template = japanese_hairstyles_common
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_afro
                    }
                }
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                shogunate_should_be_no_hair_trigger = no
                NOT = { exists = dynasty }
            }
        }
    }

    ainu_generic = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = hairstyles
                template = ainu_hairstyles
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_afro
                    }
                }
                portrait_ainu_clothing_trigger = yes
                shogunate_should_be_no_hair_trigger = no
            }
        }
    }

    shogunate_no_hair = { # This is to give a random chance of a clean shaven look
        dna_modifiers = {
            accessory = {
                mode = add
                gene = hairstyles
                template = no_hairstyles
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 55
                exists = this
                shogunate_should_be_no_hair_trigger = yes
            }
        }
    }
}
